<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<body>
<script>
function chk(data){
	if(!data.categoryName.value.trim()){
		$("#error").html("카테고리명을 입력하세요");
		return false;
	}
}
</script>
<h2 align="center">카테고리 수정</h2>
<c:choose>
	<c:when test="${requestScope.error_message != null}">
		<div align="center" style="color: red;">${requestScope.error_message}</div>
	</c:when>
	<c:otherwise>
		<div id="error" align="center" style="color: red;"></div>
	</c:otherwise>
</c:choose>
<form action="/droowa/product/modifyCategory.do" onsubmit="return chk(this)" method="post">
<input type="hidden" name="categoryId" value="${requestScope.firstCategory.categoryId}">
<table align="center">
	<tr align="center" bgcolor="#BDBDBD">
		<td width="65">아이디</td>
		<td width="200">카테고리명</td>
		<td>수정</td>
	</tr>
	<tr align="center">
		<td>${requestScope.firstCategory.categoryId}</td>
		<td>
			<input type="text" name="categoryName" id="categoryName" value="${requestScope.firstCategory.categoryName}" style="width:295px;">
		</td>
		<td>
			<input type="submit" value="수정" style="width:40px;">
		</td>
	</tr>
</table>
</form>
</body>
